﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using Database;
using Business.ConnectDatabase;
using Business.Utilities;

namespace myWallet
{
    public partial class Login : App_Code.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            tblAccount obj = new AccountDB().GetByEmailAndPassword(txtEmail.Text.Trim(), MD5.EncPwd(txtPassword.Text.Trim()));
            if (obj != null)
            {
                Session["UserId"] = obj.Id.ToString();
                Response.Redirect("Default.aspx", false);
            }
            else
            {
                pnMessage.InnerHtml = GetGlobalResourceObject("Common", "LoginFailed").ToString();
                pnMessage.Visible = true;
            }
        }
    }
}